//
//  TestTrie.cpp
//  DemoV2
//
//  Created by 董一龙 on 2022/8/7.
//

#include "TestTrie.hpp"
#include "Log.hpp"
#include "../util/Trie.hpp"

void testTrie() {
    LOGINFO("Test Prefix Start");
    
    Trie trie;
    trie.insertPrefixSet({
        "__NS",
        "FBS",
        "_UI",
        "_CFX"
    });
    
    LOGERROR_IF(!trie.hasPrefixMatch("__NSCFNumber"), "__NSCFNumber Error");
    LOGERROR_IF(!trie.hasPrefixMatch("FBSWorkspace"), "FBSWorkspace Error");
    LOGERROR_IF(!trie.hasPrefixMatch("_UIApplicationConfigurationLoade"), "_UIApplicationConfigurationLoade Error");
    LOGERROR_IF(!trie.hasPrefixMatch("_CFXPreferences"), "_CFXPreferences Error");
    LOGERROR_IF(trie.hasPrefixMatch("BKSMousePointerService"), "BKSMousePointerService Error");
    LOGERROR_IF(trie.hasPrefixMatch("HomeChannelViewController"), "HomeChannelViewController Error");
    
    LOGINFO("Test Prefix Pass");
    
    return;
}
